#ifndef LISTEN_THREAD_H
#define LISTEN_THREAD_H

#include <QThread>
#include <QAtomicInteger>
#include "cmdlineparser.h"
#define TBTUNID 0x7FFFFFFE
#define TBPORTNAME "TASKBUS"

void stdoutLoop(TASKBUS::cmdlineParser * args, std::function<void(QString)> msg);

class listen_thread: public QThread
{
	Q_OBJECT
public:
	explicit listen_thread(const TASKBUS::cmdlineParser * cmdline, QObject * parent);
	static QAtomicInteger<quint64> m_refTms;
	QAtomicInteger<qint64> m_total_pack;
protected:
	const TASKBUS::cmdlineParser * m_cmd = nullptr;
	void run() override;
signals:
	void quit_app();
	void sig_message(QString);
};

#endif // LISTEN_THREAD_H
